-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: support else
blocks with !
return type in convert_to_guarded_return
#20758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0f18d92
to
42142f7
Compare
// if !cond { | ||
// return; | ||
// } | ||
// if !cond { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall but I think we'd prefer the former return;
stmt over { return }
as rustfmt does so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make it more compact in let-chain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
Add support for else-block of never-type for `convert_to_guarded_return` Example --- ```rust fn main() { if$0 let Ok(x) = Err(92) { foo(x); } else { return } } ``` **Before this PR**: Assist not applicable **After this PR**: ```rust fn main() { let Ok(x) = Err(92) else { return }; foo(x); } ```
589f157
to
3b5e529
Compare
@ShoyuVanilla Do you have time to review this PR and some older PRs? |
Yes, but one or two days later. I have to fix some cargo related issues as they worsen developer experiences for some people by a lot 😅 |
But I'll review some relatively simple PRs before then |
else
blocks with !
return type in convert_to_guarded_return
Add support for else-block of never-type for
convert_to_guarded_return
Example
Before this PR:
Assist not applicable
After this PR: